import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
const importer = require(`./${process.env.NODE_ENV}`).default

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home,
        redirect: '/myWait',
        children: [
            {
                path: '/linkDetail',
                name: 'linkDetail',
                component: importer(/* webpackChunkName: "Overview" */ 'feedBack/linkDetail')
            },
            {
                path: '/OverView',
                name: 'overView',
                component: importer(/* webpackChunkName: "Overview" */ 'overView/overView')
            },
            {
                path: '/dataStatistics',
                name: 'dataStatistics',
                meta: {
                    keepAlive: true
                },
                component: importer(/* webpackChunkName: "dataStatistics" */ 'dataStatistics/dataStatistics')
            },
            {
                path: '/dataStaticDetail',
                name: '/dataStaticDetail',
                props: true,
                component: importer(/* webpackChunkName: "dataStatistics" */ 'dataStatistics/dataStaticDetail')
            },
            {
                path: 'task',
                name: 'task',
                component: importer(/* webpackChunkName: "task" */ 'task/task'),
                meta: {
                    keepAlive: true
                }
            },
            {
                path: 'feedBack',
                name: 'feedBack',
                component: importer(/* webpackChunkName: "Feedback" */ 'feedBack/feedBack'),
                meta: {
                    keepAlive: true
                }
            },
            // {
            //     path: 'DetailsFeedBack',
            //     name: 'DetailsFeedBack',
            //     component: importer(/* webpackChunkName: "myLaunch" */ 'overView/details')
            // },
            {
                path: 'Details',
                name: 'Details',
                component: importer(/* webpackChunkName: "myLaunch" */ 'feedBack/details')
            },
            {
                path: 'delateMeeting',
                name: 'delateMeeting',
                component: importer(/* webpackChunkName: "myWait" */ 'delateMeeting/delateMeeting')
            },
            {
                path: 'mettingDetail',
                name: 'mettingDetail',
                component: importer(/* webpackChunkName: "myWait" */ 'delateMeeting/mettingDetail'),
                meta: {
                    keepAlive: false
                }
            },

            {
                path: 'myWait',
                name: 'myWait',
                component: importer(/* webpackChunkName: "myWait" */ 'myWait/myWait'),
                meta: {
                    keepAlive: true
                }
            },
            {
                path: 'createFeedBack',
                name: 'createFeedBack',
                component: importer(/* webpackChunkName: "createFeedBack" */ 'feedBack/createFeedBack/createFeedBack')
            },
            {
                path: 'editFeedBack',
                name: 'editFeedBack',
                component: importer(/* webpackChunkName: "editFeedBack" */ 'feedBack/editFeedBack/editFeedBack')
            },
            {
                path: 'taskDetail',
                name: 'taskDetail',
                component: importer(/* webpackChunkName: "taskDetail" */ 'task/taskDetails/taskDetails')
            },
            {
                path: 'turnBug',
                name: 'turnBug',
                component: importer(/* webpackChunkName: "turnBug" */ 'feedBack/turnBug/turnBug')
            },
            {
                path: 'turnDemand',
                name: 'turnDemand',
                component: importer(/* webpackChunkName: "turnDemand" */ 'feedBack/turnDemand/turnDemand')
            },
            {
                path: 'systemSetting',
                name: 'systemSetting',
                component: importer(/* webpackChunkName: "systemSetting" */ 'systemSetting/setting'),
                children: [
                    {
                        path: '/systemSetting',
                        redirect: '/systemSetting/column'
                    },
                    {
                        path: 'column',
                        name: 'column',
                        component: importer(/* webpackChunkName: "column" */ 'systemSetting/column')
                    },
                    {
                        path: 'lane',
                        name: 'lane',
                        component: importer(/* webpackChunkName: "lane" */ 'systemSetting/lane')
                    },
                    {
                        path: 'marketingProStatus',
                        name: 'marketingProStatus',
                        component: importer(/* webpackChunkName: "marketingProStatus" */ 'systemSetting/marketingProStatus')
                    },
                    {
                        path: 'messageSettings',
                        name: 'messageSettings',
                        component: importer(/* webpackChunkName: "messageSettings" */ 'systemSetting/messageSettings')
                    },
                    {
                        path: 'productSettings',
                        name: 'productSettings',
                        component: importer(/* webpackChunkName: "productSettings" */ 'systemSetting/productSettings')
                    },
                    {
                        path: 'stageSettings',
                        name: 'stageSettings',
                        component: importer(/* webpackChunkName: "stageSettings" */ 'systemSetting/stageSettings')
                    },
                    {
                        path: 'emileSettings',
                        name: 'emileSettings',
                        component: importer(/* webpackChunkName: "stageSettings" */ 'systemSetting/emileSettings')
                    },
                    {
                        path: 'overTineMeeting',
                        name: 'overTineMeeting',
                        component: importer(/* webpackChunkName: "stageSettings" */ 'systemSetting/overTineMeeting')
                    },
                    {
                        path: 'noticeSetting',
                        name: 'noticeSetting',
                        component: importer(/* webpackChunkName: "stageSettings" */ 'systemSetting/noticeSetting/noticeSetting')
                    }
                ]
            }
        ]
    },
    {
        path: '/Login',
        name: 'Login',
        component: importer(/* webpackChunkName: "Login" */ 'login')
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router
